from core.support import set_cutscene, get_game
from core.item import Item
from core.action import Action

class CrumpledNote(Item):
    def __init__(self):
        Item.__init__(self, "CrumpledNote")    # do basic initialization for every item
        self.is_read = False
        
    #adding read action to note item
        self.add_action(Read)
    
    def get_description(self):
        return "Crumpled Note"

 
class Read(Action):
    def __init__(self):
        Action.__init__(self, "read_it")
    
    # return description of action (used in label on webpage)
    def get_description(self):
        return "Read the Note"
    
    def do_action(self,game,room,request):
        
        #sets item to being read
        player = game.get_player()
        player.add_status("note_read")
    
        set_cutscene("The note says: Find my locker and my escape plan if you want to survive! Good luck!")
        return
    
    def get_method(self):
        return "post"
    
    def is_enabled(self):
        game = get_game()
        player = game.get_player()
        if player.has_status("note_read"):
            return False
        else:
            return True